--[[/**
-- * 
 * 改变能量，溢出则增加buff
 *
 * @author heyang
-- *
-- */]]

---@class BuffEffect325100 : BaseBuffEffect
BuffEffect325100 = ClientFight.CreateClass("BuffEffect325100", ClientFight.BaseBuffEffect)
local t = BuffEffect325100
t.BUFF_EFFECT_325100_TOTAL_MOVE = "BUFF_EFFECT_325100_TOTAL_MOVE";
---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = {...};
    local effectVal = buff.buffBean.f_BuffEffectValue;
    local totalMove = buff.effectParams[t.BUFF_EFFECT_325100_TOTAL_MOVE] or 0;
    totalMove = totalMove + parameters[2];
    local ratio = MathUtil.toRatio(effectVal[1]);
    if (totalMove >= ratio) then
        local overlay = (totalMove / ratio);
        BuffManager.addBuff(fight, buff.skill, buff.source, buff.target, false, effectVal[2], overlay, parameters);
        totalMove = totalMove - ratio * overlay;

        SkillRoleMgr.savePathFile(string.format("[%s][EFFECT]Fighter%s Buff%s 克拉拉技能3移动距离超过%s,增加buff%s",
                fight.frame, buff.target.fighterId, buff.modelId, effectVal[1], effectVal[2]
        ));
    end
    buff.effectParams[t.BUFF_EFFECT_325100_TOTAL_MOVE] = totalMove;
    return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
end

t.New()